/*****************************************************************************
 * Copyright (C) Stacy Curl. All rights reserved.                            *
 * ------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the BSD      *
 * style license a copy of which has been included with this distribution in *
 * the LICENSE.txt file.                                                     *
 *****************************************************************************/
package picounit.features.ruby_string.delayed;

import moved.org.objectweb.asm.MethodVisitor;

public class MultiANewArrayInstruction extends AbstractMethodInstruction {
	private final String desc;
	private final int dims;

	public MultiANewArrayInstruction(String desc, int dims) {
		this.desc = desc;
		this.dims = dims;
	}
	
	///////////////////////////////////////////////////////////////////////////////////////////////
	// MethodInstruction Methods
	///////////////////////////////////////////////////////////////////////////////////////////////
	
	public void accept(MethodVisitor methodVisitor) {
		methodVisitor.visitMultiANewArrayInsn(desc, dims);
	}
	
	///////////////////////////////////////////////////////////////////////////////////////////////
	// Object Methods
	///////////////////////////////////////////////////////////////////////////////////////////////

	@Override
	public boolean equals(Object object) {
		if (object == null || !(object.getClass().equals(getClass()))) {
			return false;
		}

		MultiANewArrayInstruction other = (MultiANewArrayInstruction) object;

		return desc.equals(other.desc) &&
			dims == other.dims;
	}
}
